package edu.yuhf.entity;

import static javax.persistence.GenerationType.SEQUENCE;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

//hibernate部分
@Entity		//指明当前是一个实体类
@Table(name="USERS")	//指定当前类所对应的表
public class User  implements java.io.Serializable {

	private static final long serialVersionUID = 1004397876953974643L;
	private Long id;
    private String name;
    private String password;
    private String telephone;

    public User() {
    }

    public User(String name, String password,String telephone) {
        this.name = name;
        this.password = password;
        this.telephone=telephone;
    }

    public User(Long id,String name, String password,String telephone) {
    	this.id=id;
        this.name = name;
        this.password = password;
        this.telephone=telephone;
    }    
    
    @SequenceGenerator(name="generator",sequenceName="user_id",allocationSize=1)	//指定生成策略所对应的具体序列
    @Id 	//指定当前属性是主键属性即，OID
    @GeneratedValue(strategy=SEQUENCE, generator="generator")		//指定生成策略
    @Column(name="ID", unique=true, nullable=false, precision=10, scale=0)
    public Long getId() {
        return this.id;
    }
    
    public void setId(Long id) {
        this.id = id;
    }
    //指定name属性对应表中的NAME列
    @Column(name="NAME", nullable=false, length=50)
    public String getName() {
        return this.name;
    }
    
    public void setName(String name) {
        this.name = name;
    }
    
    @Column(name="PASSWORD", nullable=false, length=50)
    public String getPassword() {
        return this.password;
    }
    
    public void setPassword(String password) {
        this.password = password;
    }
    @Column(name="telephone", nullable=false, length=50)
	public String getTelephone() {
		return telephone;
	}

	public void setTelephone(String telephone) {
		this.telephone = telephone;
	}
    
}